package com.liuzhongni.wahahanews.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListView;

import com.liuzhongni.wahahanews.R;
import com.liuzhongni.wahahanews.activity.LoginActivity;
import com.liuzhongni.wahahanews.adapter.ListViewAdapterOfMyself;

/**
 * Created by dllo on 16/1/7.
 */
public class MyselfFragment extends Fragment implements View.OnClickListener {
    private ListView listView;
    private ListViewAdapterOfMyself adapter;
    private ImageView imageViewHead;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_myself,null);
        imageViewHead = (ImageView) view.findViewById(R.id.myself_head_iv);
        listView = (ListView) view.findViewById(R.id.myself_lv);
        adapter = new ListViewAdapterOfMyself(getActivity());
        listView.setAdapter(adapter);
        imageViewHead.setOnClickListener(this);
        return view;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.myself_head_iv:
                Intent intent = new Intent(getActivity(), LoginActivity.class);
                startActivity(intent);
                break;
        }
    }
}
